package com.emm.yixun.common.utils.conf;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class AppPropertiesFactory {

	private static Properties confiProperties;

	/**
	 * 通过属性文件加载属性值
	 * 
	 * @param propertyKey
	 * @return
	 */
	public static String getPropertyValue(String propertyKey) {
		if (confiProperties == null) {
			synchronized (AppPropertiesFactory.class) {
				if (confiProperties == null) {
					confiProperties = new Properties();
					InputStream is = null;
					try {
						is = Thread
								.currentThread()
								.getContextClassLoader()
								.getResourceAsStream(
										"properties/xfpush.properties");
						confiProperties.load(is);
					} catch (IOException e) {
					} finally {
						if (is != null) {
							try {
								is.close();
							} catch (IOException e1) {
								e1.printStackTrace();
							}
						}
					}
				}
			}
		}

		return confiProperties.getProperty(propertyKey);
	}

}
